package com.zhengxyou.jetpackdemo;

import android.app.Application;
import android.content.Context;

import com.facebook.stetho.Stetho;
import com.zhengxyou.jetpackdemo.greenDao.DaoMaster;
import com.zhengxyou.jetpackdemo.greenDao.DaoSession;
import com.zhengxyou.jetpackdemo.greenDao.DbOpenHelper;

public class MyApplication extends Application {
    static Context mGlobeContext;
    private DaoSession daoSession;

    @Override
    public void onCreate() {
        super.onCreate();
        mGlobeContext = this;
        Stetho.initializeWithDefaults(this);

//        daoSession=new DaoMaster(new DaoMaster.DevOpenHelper(this,"greendao_demo_db").getWritableDb()).newSession();
        daoSession = new DaoMaster(new DbOpenHelper(this, "greendao_demo_db").getWritableDb()).newSession();
    }

    public static Context getGlobeContext() {
        return mGlobeContext;
    }

    public DaoSession getDaoSession() {
        return daoSession;
    }
}
